package com.atguigu.patterns.singleton;


// 静态内部类完成， 推荐使用
public class SingletonStaticInnerClass implements AbstractSingleton {
	private static volatile SingletonStaticInnerClass instance;
	
	//构造器私有化
	private SingletonStaticInnerClass() {}
	
	//写一个静态内部类,该类中有一个静态属性 SingletonStaticInnerClass
	private static class SingletonStaticInnerClassInstance {
		private static final SingletonStaticInnerClass INSTANCE = new SingletonStaticInnerClass(); 
	}
	
	//提供一个静态的公有方法，直接返回SingletonStaticInnerClassInstance.INSTANCE
	public static synchronized SingletonStaticInnerClass getInstance() {
		return SingletonStaticInnerClassInstance.INSTANCE;
	}

	public void warn(){
		//ignore Instantiation of utility class 'SingletonStaticInnerClass'
	}
}
